' Draw 10 Red Balloons each with a string SCREEN 12 ' start up graphics COLOR 4 ' set the pen color to red ' LET BALLOON = 1 ' start with balloon number 1 DO WHILE BALLOON <= 10 ' end with balloon number 10 LET X = BALLOON * 64 - 32 ' calculate an X for this balloon CIRCLE (X, 100), 25 ' draw a balloon LINE (X, 125) - (X,225) ' draw its string LET BALLOON = BALLOON + 1 ' go on to next balloon LOOP ' END
Since the string is in the same column as the center of the circle, both the startX and the endX are the same value, the X of the balloon's center. Since the radius of the balloon is 25, the string should start 25 pixels down from the center:
The center: (X, 100) 25 pixels down: (X, 125)
Remember that Y increases going down. To make the string 100 pixels long, add 100 to the line's startY:
The start of the string: (X, 125) The end of the string: (X, 225)
The balloon and string look like the following:
But the program so far draws both balloon and string in the same color (red, color number 4). Here is the program, again, but with some changes part way made so that the balloon is drawn with pen color number 4 (RED) and the string is drawn with pen color number 2 (GREEN):
' Draw 10 Red Balloons each with a GREEN string SCREEN 12 ' start up graphics ' LET BALLOON = 1 ' start with balloon number 1 DO WHILE BALLOON <= 10 ' end with balloon number 10 LET X = BALLOON * 64 - 32 ' calculate an X for this balloon ' COLOR ______ ' set the pen color to red CIRCLE (X, 100), 25 ' draw a balloon ' COLOR ______ ' set the pen color to green LINE (X, 125) - (X,225) ' draw its string LET BALLOON = BALLOON + 1 ' go on to next balloon LOOP END
Fill in the blanks of the COLOR
statements.